Skip to content

fix(#62,#69): consolidate walletStore with walletServiceManager and add network detection UI#499

Open
sheyman546 wants to merge 1 commit into
Smartdevs17:mainfrom
sheyman546:fix/wallet-consolidate-network-detection
Open

fix(#62,#69): consolidate walletStore with walletServiceManager and add network detection UI#499
sheyman546 wants to merge 1 commit into
Smartdevs17:mainfrom
sheyman546:fix/wallet-consolidate-network-detection

Conversation

@sheyman546
Copy link
Copy Markdown

Summary

Fixes two related wallet issues in a single cohesive change.

#62 — Consolidate walletStore with walletService

  • walletStore now derives all connection state (address, chainId, network, isConnected) from walletServiceManager via a listener subscription
  • walletServiceManager is the single source of truth — no duplicate state, no stale wallet property
  • syncWalletConnection delegates to walletServiceManager.setConnection(), which triggers the listener and updates the store automatically

#69 — Network detection and switching

  • Added preferredNetwork, networkMismatch, setPreferredNetwork, and detectNetworkMismatch to walletStore
  • Mismatch detection runs on every connection change (via the walletServiceManager listener) and on explicit setPreferredNetwork calls
  • Stellar networks are excluded from mismatch detection (no numeric chainId)
  • WalletConnectScreen: added a yellow warning banner when the connected EVM chain differs from the preferred network, with a "Switch" button
  • WalletConnectScreen: added a bottom-sheet network picker modal (all EVM + Stellar networks) so users can change their preferred network inline

Tests

  • Rewrote the walletStore integration test suite to match the new consolidated API
  • Added mocks for walletService and networkService so tests run without native/ethers dependencies
  • Added tests for: syncWalletConnection, listener-driven sync, detectNetworkMismatch (mismatch, match, Stellar no-op)

Files changed

  • src/store/walletStore.ts — consolidated store with network detection
  • src/screens/WalletConnectScreen.tsx — mismatch banner + network picker modal
  • src/store/__tests__/integration.test.ts — updated walletStore test suite

Closes #62
Closes #69

…etServiceManager and add network detection UI

- walletStore now derives all connection state (address, chainId, network,
  isConnected) from walletServiceManager via a listener subscription, making
  walletServiceManager the single source of truth (Smartdevs17#62)
- Added setPreferredNetwork, detectNetworkMismatch, and networkMismatch state
  to walletStore for EVM network mismatch detection (Smartdevs17#69)
- WalletConnectScreen: added network mismatch warning banner and a bottom-sheet
  network picker modal (FlatList of ALL_NETWORKS) so users can switch their
  preferred network without leaving the screen (Smartdevs17#69)
- Updated integration.test.ts walletStore suite to match the new consolidated
  API: removed stale wallet/\@subtrackr_wallet references, added mock for
  walletService and networkService, added tests for syncWalletConnection,
  listener-driven sync, and network mismatch detection

Closes Smartdevs17#62
Closes Smartdevs17#69
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@sheyman546 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Smartdevs17
Copy link
Copy Markdown
Owner

⚠️ Merge failed — check CI status.

🤖 Drips Wave Merge Agent

1 similar comment
@Smartdevs17
Copy link
Copy Markdown
Owner

⚠️ Merge failed — check CI status.

🤖 Drips Wave Merge Agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🔧 Add network detection and switching 🔧 Consolidate walletStore with walletService

2 participants